package com.molichuxing.gateway.observer;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.molichuxing.gateway.observer.observable.MessageEvent;
import com.molichuxing.gateway.observer.observer.AppMsgObserver;
import com.molichuxing.gateway.observer.observer.DingTalkObserver;
import com.molichuxing.gateway.observer.observer.EmailObserver;
import com.molichuxing.gateway.observer.observer.OpMsgObserver;
import com.molichuxing.gateway.observer.observer.SmsObserver;

@Component
public class EventManager {
	private final static Logger logger = LoggerFactory.getLogger(EventManager.class);

	@Resource
	private MessageEvent messageEvent;

	@Resource
	private SmsObserver sms;

	@Resource
	private EmailObserver email;

	@Resource
	private AppMsgObserver appMsg;

	@Resource
	private DingTalkObserver dingTalk;

	@Resource
	private OpMsgObserver opMsg;

	@PostConstruct
	public void init() {
		messageEventInit();
	}

	private void messageEventInit() {
		messageEvent.addObserver(sms);
		messageEvent.addObserver(email);
		messageEvent.addObserver(appMsg);
		messageEvent.addObserver(dingTalk);
		messageEvent.addObserver(opMsg);
	}
}
